8ef2babec6e6a3720034f6fd5c3433743e999d9e,thymeleaf-spring4/src/main/java/org/thymeleaf/spring4/processor/SpringInputRadioFieldTagProcessor.java,SpringInputRadioFieldTagProcessor,doProcess,#ITemplateContext#IProcessableElementTag#AttributeName#String#BindStatus#IElementTagStructureHandler#,59
Before Change
SelectedValueComparatorWrapper.isSelected(bindStatus, HtmlEscape.unescapeHtml(value));
tag.getAttributes().setAttribute("id", id); // No need to escape: this comes from an existing 'id' or from a token
tag.getAttributes().setAttribute("name", name); // No need to escape: this is a java-valid token
tag.getAttributes().setAttribute(
"value", RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "radio"));
if (checked) {
tag.getAttributes().setAttribute("checked", "checked");
} else {
tag.getAttributes().removeAttribute("checked");
}
}
After Change
final BindStatus bindStatus, final IElementTagStructureHandler structureHandler) {
String name = bindStatus.getExpression();
name = (name == null? "" : name);
final String id = computeId(context, tag, name, true);
final IElementAttributes attributes = tag.getAttributes();
final String value = attributes.getValue(this.valueAttributeDefinition.getAttributeName());
if (value == null) {
throw new TemplateProcessingException(
"Attribute \"value\" is required in \"input(radio)\" tags");
}
final boolean checked =
SelectedValueComparatorWrapper.isSelected(bindStatus, HtmlEscape.unescapeHtml(value));
StandardProcessorUtils.setAttribute(attributes, this.idAttributeDefinition, ID_ATTR_NAME, id); // No need to escape: this comes from an existing 'id' or from a token
StandardProcessorUtils.setAttribute(attributes, this.nameAttributeDefinition, NAME_ATTR_NAME, name); // No need to escape: this is a java-valid token
StandardProcessorUtils.setAttribute(
attributes, this.valueAttributeDefinition, VALUE_ATTR_NAME, RequestDataValueProcessorUtils.processFormFieldValue(context, name, value, "radio"));
if (checked) {
StandardProcessorUtils.setAttribute(attributes, this.checkedAttributeDefinition, CHECKED_ATTR_NAME, CHECKED_ATTR_NAME);
} else {
attributes.removeAttribute(this.checkedAttributeDefinition.getAttributeName());
}
}